public class LoginServlet implements Servlet{
    @Override
    public void doGet(Request request, Response response) throws Exception {
        System.out.println("进入了LoginServlet");

        String username = request.getParameter("username");
        String password = request.getParameter("password");

        System.out.println("username "+username);
        System.out.println("password "+password);
        if ("admin".equals(username.trim()) && "admin".equals(password.trim())) {
            request.getSession().setAttribute("username", "admin");
        } else {
            request.getSession().setAttribute("username", "Unknown User");
        }


        //跳转界面
        JspServlet jspServlet = new JspServlet();
        jspServlet.setPath("WebContent/test6.jsp");
        jspServlet.doGet(request,response);
    }

    @Override
    public void doPost(Request request, Response response) throws Exception {
        doGet(request,response);
    }
}
